package com.bnz.controller;

import com.bnz.entity.TbSeckillGoods;
import com.bnz.service.TbSeckillGoodsService;
import com.bnz.utils.MyDate;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;
import java.util.List;

@Controller
//@RequestMapping
public class SeckillController {

    @Autowired
    private TbSeckillGoodsService tbSeckillGoodsService;

    @GetMapping({"/","seckill-index.html"})
    public String index(Model model){ // 将数据放进model中
        // 1、得到当前时间段开始的五个时间段（一天分为12段 0:00开始） MyDate:common里的时间工具类
        List<Date> dateMenus = MyDate.getDateMenus();
         System.out.println(dateMenus);
        // 2、将得到的当前的时间段放进model (seckill-index.html 114行 dateMenus)
        model.addAttribute("dateMenus",dateMenus); // 放进前端的dateMenus中

        return "seckill-index";
    }
}
